(another) three index constraint question

13 views
Skip to first unread message

Andrew Gill

unread,
May 13, 2025, 2:36:41 PMMay 13
to MiniZinc
Hi - in my mind, this makes sense:

constraint forall([n[j] + n[i] != T_plus[u] | i,j in main_factors where i < j /\ u in two_ways where u <= (j-1)*(j-2) div 2]);

but clearly MiniZinc doesnt think like me (:-)). 

Can someone please tell me how to code "a,b in c where d and e in f where g"?

Thank you.

Andrew

jason.nguyen

unread,
May 13, 2025, 3:13:16 PMMay 13
to MiniZinc
Hi,

The separator for generators in a comprehension is the comma, not the /\ operator:

constraint forall([n[j] + n[i] != T_plus[u] | i,j in main_factors where i < j, u in two_ways where u <= (j-1)*(j-2) div 2]);

Regards,
Jason

Andrew Gill

unread,
May 13, 2025, 3:15:00 PMMay 13
to mini...@googlegroups.com
that makes perfect sense! Thank you.

--
You received this message because you are subscribed to the Google Groups "MiniZinc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minizinc+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/minizinc/c55b57f7-8c10-4c69-8441-b36e8c87f308n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages